package com.xuecheng.framework.domain.course;


import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;


/**
 * Created by admin on 2018/2/10.
 */
@Data
@ToString
@Entity
@Table(name = "course_pub")
@GenericGenerator(name = "jpa-assigned", strategy = "assigned")
@Document(indexName = "xc_course", shards = 1, replicas = 0)
public class CoursePub implements Serializable {
    private static final long serialVersionUID = -916357110051689487L;

    @Id
    @GeneratedValue(generator = "jpa-assigned")
    @Column(length = 32)
    @Field(type = FieldType.Keyword)
    private String id;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String name;

    @Field(type = FieldType.Text, index = false)
    private String users;

    @Field(type = FieldType.Keyword)
    private String mt;

    @Field(type = FieldType.Keyword)
    private String st;

    @Field(type = FieldType.Keyword)
    private String grade;

    @Field(type = FieldType.Keyword)
    private String studymodel;

    @Field(type = FieldType.Keyword)
    private String teachmode;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String description;

    //图片
    @Field(type = FieldType.Keyword, index = false)
    private String pic;

    //时间戳
    @Field(type = FieldType.Date, format = DateFormat.date_time)
    private Date timestamp;

    @Field(type = FieldType.Keyword)
    private String charge;

    @Field(type = FieldType.Keyword)
    private String valid;

    @Field(type = FieldType.Keyword, index = false)
    private String qq;

    private Float price;

    private Float price_old;

    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    private String expires;

    //课程计划
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String teachplan;

    //课程发布时间
    @Column(name = "pub_time")
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    private String pubTime;
}
